package com.vc.util;

import java.io.File;
import java.io.FileOutputStream;

import android.os.Environment;

public class FileUtil {
	
	/**
	 * 写文件
	 * @param fileName 文件名
	 * @param bytes 文件流
	 * @return
	 */
	public static int writeFileToSdcard(String fileName,byte[] bytes){
		if(bytes==null || bytes.length < 1){
			return -1;
		}		
		try{
			File file = new File(Environment.getExternalStorageDirectory(), fileName);
			FileOutputStream fout = new FileOutputStream(file);
			fout.write(bytes);
			fout.close();
		}catch(Exception e){
			e.printStackTrace();
			return -1;
		}
		return 0;
	}

}
